<h1>字符串函数 - memchr</h1>


  <p>原型：extern void *memchr(void *buf, char ch, unsigned count);</p>

  <p>用法：#include &lt;string.h></p>
  
  <p>功能：从buf所指内存区域的前count个字节查找字符ch。</p>
  
  <p>说明：当第一次遇到字符ch时停止查找。如果成功，返回指向字符ch的指针；否则返回NULL。</p>
  
  举例：<pre><code class="language-c">

      // memchr.c
      
      #include &lt;syslib.h>
      #include &lt;string.h>

      main()
      {
        char *s="Hello, Programmers!";
        char *p;
        
        clrscr();
        
        p=memchr(s,'P',strlen(s));
        if(p)
          printf("%s",p);
        else
          printf("Not Found!");

        getchar();
        return 0;
      }
      
  </code></pre>相关函数：<a href="memccpy.html">memccpy</a>,<a href="memmove.html">memmove</a>,<a href="strcpy.html">strcpy</a>

